home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 2003 September / PC Answers September 2003.iso / Software / trial / AutoMate 5.0.4.1 / automate5_eval_setup.exe / Custom_Functions__Square_Number.aml < prev    next >
Encoding:
Text File  |  2002-05-12  |  1.6 KB  |  34 lines

  1. <AM5TASK>
  2. <AMTASKHEAD>
  3.     <TASKINFO TASKNAME="">
  4. <\AMTASKHEAD>
  5. <STEPS>
  6. <!---       Show message box telling the user what is going on --->
  7. <AMMESSAGEBOX WINDOWTITLE="Sample Task" BUTTONS="ok_cancel" ICON="information" ONSECONDBUTTONCLICK="stop">This sample task demonstrates the following:
  8. 1) Use of the Input Action to ask the user a question and retrieve the answer
  9. 2) Use of Custom BASIC Functions
  10. 3) Use of the IF action
  11. 4) Use of Expressions
  12.  
  13. Remember you can always stop a task in progress by pressing CTRL-ALT-END. Press okay to continue running the task or Cancel to stop now.</AMMESSAGEBOX>
  14. <!---              Create variable to store answer from input box. --->
  15. <AMVARIABLE NAME="theanswer" DESCRIPTION=""></AMVARIABLE>
  16. <!---              This custom function takes a number, squares it, and returns 
  17. the result. --->
  18. <AMSCRIPT>Function SquareNumber(thenum) 
  19.     SquareNumber = thenum * thenum
  20. End Function</AMSCRIPT>
  21. <!---              Input box will ask what number user would like to square. --->
  22. <AMINPUTBOX RESULTVARIABLE="theanswer">What number would you like to square?</AMINPUTBOX>
  23. <!---             Make sure that the value entered is a valid number. --->
  24. <AMIF EXPRESSION="IsNumeric(theanswer) = true">
  25.  <!---              Display result of answer send to our custom function. --->
  26.            <AMMESSAGEBOX>The number %theanswer% squared  is:
  27. %SquareNumber(theanswer)%</AMMESSAGEBOX>
  28. <AMELSE>
  29.  <!---             Tell the user an invalid entry was entered. --->
  30.           <AMMESSAGEBOX>The text "%theanswer%" is not a valid number.  Please re-run and enter a valid number.</AMMESSAGEBOX>
  31. </AMIF>
  32. <\STEPS>
  33. </AM5TASK>
  34.